﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="api_counter.aspx.cs" Inherits="api_counter" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="office,cmd_type"
            DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="office" HeaderText="office" ReadOnly="True" SortExpression="office" />
                <asp:BoundField DataField="cmd_type" HeaderText="cmd_type" ReadOnly="True" SortExpression="cmd_type" />
                <asp:BoundField DataField="count" HeaderText="count" SortExpression="count" />
                <asp:BoundField DataField="reset_time" HeaderText="reset_time" SortExpression="reset_time" />
                <asp:BoundField DataField="last_count" HeaderText="last_count" SortExpression="last_count" />
                <asp:BoundField DataField="last_reset_time" HeaderText="last_reset_time" SortExpression="last_reset_time" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SparrowDB %>"
            DeleteCommand="DELETE FROM [api_counter] WHERE [office] = @office AND [cmd_type] = @cmd_type"
            InsertCommand="INSERT INTO [api_counter] ([office], [cmd_type], [count], [reset_time], [last_count], [last_reset_time]) VALUES (@office, @cmd_type, @count, @reset_time, @last_count, @last_reset_time)"
            SelectCommand="SELECT * FROM [api_counter]" UpdateCommand="UPDATE [api_counter] SET [count] = @count, [reset_time] = @reset_time, [last_count] = @last_count, [last_reset_time] = @last_reset_time WHERE [office] = @office AND [cmd_type] = @cmd_type">
            <DeleteParameters>
                <asp:Parameter Name="office" Type="String" />
                <asp:Parameter Name="cmd_type" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="count" Type="Int64" />
                <asp:Parameter Name="reset_time" Type="DateTime" />
                <asp:Parameter Name="last_count" Type="Int64" />
                <asp:Parameter Name="last_reset_time" Type="DateTime" />
                <asp:Parameter Name="office" Type="String" />
                <asp:Parameter Name="cmd_type" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="office" Type="String" />
                <asp:Parameter Name="cmd_type" Type="String" />
                <asp:Parameter Name="count" Type="Int64" />
                <asp:Parameter Name="reset_time" Type="DateTime" />
                <asp:Parameter Name="last_count" Type="Int64" />
                <asp:Parameter Name="last_reset_time" Type="DateTime" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="office,cmd_type" DataSourceID="SqlDataSource1"
            DefaultMode="Insert">
            <EditItemTemplate>
                office:
                <asp:Label ID="officeLabel1" runat="server" Text='<%# Eval("office") %>'></asp:Label><br />
                cmd_type:
                <asp:Label ID="cmd_typeLabel1" runat="server" Text='<%# Eval("cmd_type") %>'></asp:Label><br />
                count:
                <asp:TextBox ID="countTextBox" runat="server" Text='<%# Bind("count") %>'>
                </asp:TextBox><br />
                reset_time:
                <asp:TextBox ID="reset_timeTextBox" runat="server" Text='<%# Bind("reset_time") %>'>
                </asp:TextBox><br />
                last_count:
                <asp:TextBox ID="last_countTextBox" runat="server" Text='<%# Bind("last_count") %>'>
                </asp:TextBox><br />
                last_reset_time:
                <asp:TextBox ID="last_reset_timeTextBox" runat="server" Text='<%# Bind("last_reset_time") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                    Text="更新">
                </asp:LinkButton>
                <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消">
                </asp:LinkButton>
            </EditItemTemplate>
            <InsertItemTemplate>
                office:
                <asp:TextBox ID="officeTextBox" runat="server" Text='<%# Bind("office") %>'>
                </asp:TextBox><br />
                cmd_type:
                <asp:TextBox ID="cmd_typeTextBox" runat="server" Text='<%# Bind("cmd_type") %>'>
                </asp:TextBox><br />
                count:
                <asp:TextBox ID="countTextBox" runat="server" Text='<%# Bind("count") %>'>
                </asp:TextBox><br />
                reset_time:
                <asp:TextBox ID="reset_timeTextBox" runat="server" Text='<%# Bind("reset_time") %>'>
                </asp:TextBox><br />
                last_count:
                <asp:TextBox ID="last_countTextBox" runat="server" Text='<%# Bind("last_count") %>'>
                </asp:TextBox><br />
                last_reset_time:
                <asp:TextBox ID="last_reset_timeTextBox" runat="server" Text='<%# Bind("last_reset_time") %>'>
                </asp:TextBox><br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                    Text="插入">
                </asp:LinkButton>
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="取消">
                </asp:LinkButton>
            </InsertItemTemplate>
            <ItemTemplate>
                office:
                <asp:Label ID="officeLabel" runat="server" Text='<%# Eval("office") %>'></asp:Label><br />
                cmd_type:
                <asp:Label ID="cmd_typeLabel" runat="server" Text='<%# Eval("cmd_type") %>'></asp:Label><br />
                count:
                <asp:Label ID="countLabel" runat="server" Text='<%# Bind("count") %>'></asp:Label><br />
                reset_time:
                <asp:Label ID="reset_timeLabel" runat="server" Text='<%# Bind("reset_time") %>'>
                </asp:Label><br />
                last_count:
                <asp:Label ID="last_countLabel" runat="server" Text='<%# Bind("last_count") %>'>
                </asp:Label><br />
                last_reset_time:
                <asp:Label ID="last_reset_timeLabel" runat="server" Text='<%# Bind("last_reset_time") %>'>
                </asp:Label><br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                    Text="编辑">
                </asp:LinkButton>
                <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                    Text="删除">
                </asp:LinkButton>
                <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                    Text="新建">
                </asp:LinkButton>
            </ItemTemplate>
        </asp:FormView>
    </form>
</body>
</html>
